package com.taxi.driver.module.main.mine.wallet.withdrawalrecord;

import android.content.Context;
import android.widget.TextView;

import com.qianxx.adapter.internal.SuperViewHolder;
import com.qianxx.view.refreshview.RefreshAdapter;
import com.taxi.driver.R;
import com.taxi.driver.module.vo.WithdrawaleRecordVO;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;


public class WithdrawalRecordAdapter extends RefreshAdapter<WithdrawaleRecordVO> {
    SimpleDateFormat sf;

    public WithdrawalRecordAdapter(Context context) {
        super(context, new ArrayList<WithdrawaleRecordVO>(), R.layout.item_withdrawal_record);
        sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    }

    @Override
    public void onBind(SuperViewHolder holder, int viewType, int position, WithdrawaleRecordVO item) {
        ((TextView) holder.getView(R.id.tv_tilte)).setText(getContext()
                .getResources().getString(R.string.withdraw_fee, Math.abs(item.money) + ""));
        holder.setText(R.id.tv_date, sf.format(new Date(item.date)));
        switch (item.statue) {
            case 1:
                holder.setText(R.id.tv_statue, getContext().getResources().getString(R.string.in_review));
                break;
            case 2:
                holder.setText(R.id.tv_statue, getContext().getResources().getString(R.string.withdrawal_success));
                break;
            case 3:
                holder.setText(R.id.tv_statue, getContext().getResources().getString(R.string.withdrawal_failure));
                break;
        }
    }
}